home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 July: Mac OS SDK / Dev.CD Jul 97 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Interfaces / CIncludes / Memory.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-09-11  |  18.2 KB  |  693 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        Memory.h
  3.  
  4.      Contains:    Memory Manager Interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Package:    Universal Interfaces 2.1.4
  8.  
  9.      Copyright:    © 1984-1995 by Apple Computer, Inc.
  10.                  All rights reserved.
  11.  
  12.      Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13.                  stack.  Include the file and version information (from above)
  14.                  in the problem description and send to:
  15.                      Internet:    apple.bugs@applelink.apple.com
  16.                      AppleLink:    APPLE.BUGS
  17.  
  18. */
  19.  
  20. #ifndef __MEMORY__
  21. #define __MEMORY__
  22.  
  23.  
  24. #ifndef __TYPES__
  25. #include <Types.h>
  26. #endif
  27. /*    #include <ConditionalMacros.h>                                */
  28.  
  29. #ifndef __MIXEDMODE__
  30. #include <MixedMode.h>
  31. #endif
  32.  
  33. #ifdef __cplusplus
  34. extern "C" {
  35. #endif
  36.  
  37. #if PRAGMA_ALIGN_SUPPORTED
  38. #pragma options align=mac68k
  39. #endif
  40.  
  41. #if PRAGMA_IMPORT_SUPPORTED
  42. #pragma import on
  43. #endif
  44.  
  45.  
  46. enum {
  47.     maxSize                        = 0x800000,                        /*Max data block size is 8 megabytes*/
  48.     defaultPhysicalEntryCount    = 8,
  49. /* values returned from the GetPageState function */
  50.     kPageInMemory                = 0,
  51.     kPageOnDisk                    = 1,
  52.     kNotPaged                    = 2
  53. };
  54.  
  55. enum {
  56. /* masks for Zone->heapType field */
  57.     k32BitHeap                    = 1,                            /* valid in all Memory Managers */
  58.     kNewStyleHeap                = 2,                            /* true if new Heap Manager is present */
  59.     kNewDebugHeap                = 4                                /* true if new Heap Manager is running in debug mode on this heap */
  60. };
  61.  
  62. /* size of a block in bytes */
  63. typedef long Size;
  64.  
  65. typedef pascal long (*GrowZoneProcPtr)(Size cbNeeded);
  66. typedef pascal void (*PurgeProcPtr)(Handle blockToPurge);
  67. /*
  68.         UserFnProcPtr uses register based parameters on the 68k and cannot
  69.         be written in or called from a high-level language without the help of
  70.         mixed mode or assembly glue.
  71.  
  72.             typedef pascal void (*UserFnProcPtr)(void *parameter);
  73.  
  74.         In:
  75.          => *parameter      A0.L
  76. */
  77.  
  78. #if GENERATINGCFM
  79. typedef UniversalProcPtr GrowZoneUPP;
  80. typedef UniversalProcPtr PurgeUPP;
  81. typedef UniversalProcPtr UserFnUPP;
  82. #else
  83. typedef GrowZoneProcPtr GrowZoneUPP;
  84. typedef PurgeProcPtr PurgeUPP;
  85. typedef Register68kProcPtr UserFnUPP;
  86. #endif
  87.  
  88. typedef struct Zone Zone, *THz;
  89.  
  90. struct Zone {
  91.     Ptr                                bkLim;
  92.     Ptr                                purgePtr;
  93.     Ptr                                hFstFree;
  94.     long                            zcbFree;
  95.     GrowZoneUPP                        gzProc;
  96.     short                            moreMast;
  97.     short                            flags;
  98.     short                            cntRel;
  99.     short                            maxRel;
  100.     short                            cntNRel;
  101.     Byte                            heapType;
  102.     Byte                            unused;
  103.     short                            cntEmpty;
  104.     short                            cntHandles;
  105.     long                            minCBFree;
  106.     PurgeUPP                        purgeProc;
  107.     Ptr                                sparePtr;
  108.     Ptr                                allocPtr;
  109.     short                            heapData;
  110. };
  111. struct MemoryBlock {
  112.     void                            *address;
  113.     unsigned long                    count;
  114. };
  115. typedef struct MemoryBlock MemoryBlock;
  116.  
  117. struct LogicalToPhysicalTable {
  118.     MemoryBlock                        logical;
  119.     MemoryBlock                        physical[defaultPhysicalEntryCount];
  120. };
  121. typedef struct LogicalToPhysicalTable LogicalToPhysicalTable;
  122.  
  123. typedef short PageState;
  124.  
  125. typedef short StatusRegisterContents;
  126.  
  127. enum {
  128.     uppGrowZoneProcInfo = kPascalStackBased
  129.          | RESULT_SIZE(SIZE_CODE(sizeof(long)))
  130.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(Size))),
  131.     uppPurgeProcInfo = kPascalStackBased
  132.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(Handle))),
  133.     uppUserFnProcInfo = kRegisterBased
  134.          | REGISTER_ROUTINE_PARAMETER(1, kRegisterA0, SIZE_CODE(sizeof(void*)))
  135. };
  136.  
  137. #if GENERATINGCFM
  138. #define NewGrowZoneProc(userRoutine)        \
  139.         (GrowZoneUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppGrowZoneProcInfo, GetCurrentArchitecture())
  140. #define NewPurgeProc(userRoutine)        \
  141.         (PurgeUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppPurgeProcInfo, GetCurrentArchitecture())
  142. #define NewUserFnProc(userRoutine)        \
  143.         (UserFnUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppUserFnProcInfo, GetCurrentArchitecture())
  144. #else
  145. #define NewGrowZoneProc(userRoutine)        \
  146.         ((GrowZoneUPP) (userRoutine))
  147. #define NewPurgeProc(userRoutine)        \
  148.         ((PurgeUPP) (userRoutine))
  149. #define NewUserFnProc(userRoutine)        \
  150.         ((UserFnUPP) (userRoutine))
  151. #endif
  152.  
  153. #if GENERATINGCFM
  154. #define CallGrowZoneProc(userRoutine, cbNeeded)        \
  155.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppGrowZoneProcInfo, (cbNeeded))
  156. #define CallPurgeProc(userRoutine, blockToPurge)        \
  157.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppPurgeProcInfo, (blockToPurge))
  158. #define CallUserFnProc(userRoutine, parameter)        \
  159.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppUserFnProcInfo, (parameter))
  160. #else
  161. #define CallGrowZoneProc(userRoutine, cbNeeded)        \
  162.         (*(userRoutine))((cbNeeded))
  163. #define CallPurgeProc(userRoutine, blockToPurge)        \
  164.         (*(userRoutine))((blockToPurge))
  165. /* (*UserFnProcPtr) cannot be called from a high-level language without the Mixed Mode Manager */
  166. #endif
  167.  
  168. extern pascal Ptr GetApplLimit( void )
  169.     TWOWORDINLINE( 0x2EB8, 0x0130 ); /* MOVE.l $0130,(SP) */
  170. extern pascal THz SystemZone( void )
  171.     TWOWORDINLINE( 0x2EB8, 0x02A6 ); /* MOVE.l $02A6,(SP) */
  172. extern pascal THz ApplicationZone( void )
  173.     TWOWORDINLINE( 0x2EB8, 0x02AA ); /* MOVE.l $02AA,(SP) */
  174. extern pascal Handle GZSaveHnd( void )
  175.     TWOWORDINLINE( 0x2EB8, 0x0328 ); /* MOVE.l $0328,(SP) */
  176. extern pascal Ptr TopMem( void )
  177.     TWOWORDINLINE( 0x2EB8, 0x0108 ); /* MOVE.l $0108,(SP) */
  178. extern pascal OSErr MemError( void )
  179.     TWOWORDINLINE( 0x3EB8, 0x0220 ); /* MOVE.w $0220,(SP) */
  180.  
  181. #if !GENERATINGCFM
  182. #pragma parameter __A0 GetZone
  183. #endif
  184. extern pascal THz GetZone(void)
  185.  ONEWORDINLINE(0xA11A);
  186.  
  187. #if !GENERATINGCFM
  188. #pragma parameter __A0 NewHandle(__D0)
  189. #endif
  190. extern pascal Handle NewHandle(Size byteCount)
  191.  ONEWORDINLINE(0xA122);
  192.  
  193. #if !GENERATINGCFM
  194. #pragma parameter __A0 NewHandleSys(__D0)
  195. #endif
  196. extern pascal Handle NewHandleSys(Size byteCount)
  197.  ONEWORDINLINE(0xA522);
  198.  
  199. #if !GENERATINGCFM
  200. #pragma parameter __A0 NewHandleClear(__D0)
  201. #endif
  202. extern pascal Handle NewHandleClear(Size byteCount)
  203.  ONEWORDINLINE(0xA322);
  204.  
  205. #if !GENERATINGCFM
  206. #pragma parameter __A0 NewHandleSysClear(__D0)
  207. #endif
  208. extern pascal Handle NewHandleSysClear(Size byteCount)
  209.  ONEWORDINLINE(0xA722);
  210.  
  211. #if !GENERATINGCFM
  212. #pragma parameter __A0 HandleZone(__A0)
  213. #endif
  214. extern pascal THz HandleZone(Handle h)
  215.  ONEWORDINLINE(0xA126);
  216.  
  217. #if !GENERATINGCFM
  218. #pragma parameter __A0 RecoverHandle(__A0)
  219. #endif
  220. extern pascal Handle RecoverHandle(Ptr p)
  221.  ONEWORDINLINE(0xA128);
  222.  
  223. #if !GENERATINGCFM
  224. #pragma parameter __A0 RecoverHandleSys(__A0)
  225. #endif
  226. extern pascal Handle RecoverHandleSys(Ptr p)
  227.  ONEWORDINLINE(0xA528);
  228.  
  229. #if !GENERATINGCFM
  230. #pragma parameter __A0 NewPtr(__D0)
  231. #endif
  232. extern pascal Ptr NewPtr(Size byteCount)
  233.  ONEWORDINLINE(0xA11E);
  234.  
  235. #if !GENERATINGCFM
  236. #pragma parameter __A0 NewPtrSys(__D0)
  237. #endif
  238. extern pascal Ptr NewPtrSys(Size byteCount)
  239.  ONEWORDINLINE(0xA51E);
  240.  
  241. #if !GENERATINGCFM
  242. #pragma parameter __A0 NewPtrClear(__D0)
  243. #endif
  244. extern pascal Ptr NewPtrClear(Size byteCount)
  245.  ONEWORDINLINE(0xA31E);
  246.  
  247. #if !GENERATINGCFM
  248. #pragma parameter __A0 NewPtrSysClear(__D0)
  249. #endif
  250. extern pascal Ptr NewPtrSysClear(Size byteCount)
  251.  ONEWORDINLINE(0xA71E);
  252.  
  253. #if !GENERATINGCFM
  254. #pragma parameter __A0 PtrZone(__A0)
  255. #endif
  256. extern pascal THz PtrZone(Ptr p)
  257.  ONEWORDINLINE(0xA148);
  258.  
  259. #if !GENERATINGCFM
  260. #pragma parameter __D0 MaxBlock
  261. #endif
  262. extern pascal long MaxBlock(void)
  263.  ONEWORDINLINE(0xA061);
  264.  
  265. #if !GENERATINGCFM
  266. #pragma parameter __D0 MaxBlockSys
  267. #endif
  268. extern pascal long MaxBlockSys(void)
  269.  ONEWORDINLINE(0xA461);
  270.  
  271. #if !GENERATINGCFM
  272. #pragma parameter __D0 StackSpace
  273. #endif
  274. extern pascal long StackSpace(void)
  275.  ONEWORDINLINE(0xA065);
  276.  
  277. #if !GENERATINGCFM
  278. #pragma parameter __A0 NewEmptyHandle
  279. #endif
  280. extern pascal Handle NewEmptyHandle(void)
  281.  ONEWORDINLINE(0xA166);
  282.  
  283. #if !GENERATINGCFM
  284. #pragma parameter __A0 NewEmptyHandleSys
  285. #endif
  286. extern pascal Handle NewEmptyHandleSys(void)
  287.  ONEWORDINLINE(0xA566);
  288.  
  289. #if !GENERATINGCFM
  290. #pragma parameter HLock(__A0)
  291. #endif
  292. extern pascal void HLock(Handle h)
  293.  ONEWORDINLINE(0xA029);
  294.  
  295. #if !GENERATINGCFM
  296. #pragma parameter HUnlock(__A0)
  297. #endif
  298. extern pascal void HUnlock(Handle h)
  299.  ONEWORDINLINE(0xA02A);
  300.  
  301. #if !GENERATINGCFM
  302. #pragma parameter HPurge(__A0)
  303. #endif
  304. extern pascal void HPurge(Handle h)
  305.  ONEWORDINLINE(0xA049);
  306.  
  307. #if !GENERATINGCFM
  308. #pragma parameter HNoPurge(__A0)
  309. #endif
  310. extern pascal void HNoPurge(Handle h)
  311.  ONEWORDINLINE(0xA04A);
  312.  
  313. #if !GENERATINGCFM
  314. #pragma parameter HLockHi(__A0)
  315. #endif
  316. extern pascal void HLockHi(Handle h)
  317.  TWOWORDINLINE(0xA064, 0xA029);
  318. extern pascal Handle TempNewHandle(Size logicalSize, OSErr *resultCode)
  319.  THREEWORDINLINE(0x3F3C, 0x001D, 0xA88F);
  320. extern pascal Size TempMaxMem(Size *grow)
  321.  THREEWORDINLINE(0x3F3C, 0x0015, 0xA88F);
  322. extern pascal long TempFreeMem(void)
  323.  THREEWORDINLINE(0x3F3C, 0x0018, 0xA88F);
  324. /*  Temporary Memory routines renamed, but obsolete, in System 7.0 and later.  */
  325. extern pascal void TempHLock(Handle h, OSErr *resultCode)
  326.  THREEWORDINLINE(0x3F3C, 0x001E, 0xA88F);
  327. extern pascal void TempHUnlock(Handle h, OSErr *resultCode)
  328.  THREEWORDINLINE(0x3F3C, 0x001F, 0xA88F);
  329. extern pascal void TempDisposeHandle(Handle h, OSErr *resultCode)
  330.  THREEWORDINLINE(0x3F3C, 0x0020, 0xA88F);
  331. extern pascal Ptr TempTopMem(void)
  332.  THREEWORDINLINE(0x3F3C, 0x0016, 0xA88F);
  333. extern pascal void InitApplZone(void)
  334.  ONEWORDINLINE(0xA02C);
  335. extern pascal void InitZone(GrowZoneUPP pgrowZone, short cmoreMasters, void *limitPtr, void *startPtr);
  336.  
  337. #if !GENERATINGCFM
  338. #pragma parameter SetZone(__A0)
  339. #endif
  340. extern pascal void SetZone(THz hz)
  341.  ONEWORDINLINE(0xA01B);
  342.  
  343. #if !GENERATINGCFM
  344. #pragma parameter __D0 CompactMem(__D0)
  345. #endif
  346. extern pascal Size CompactMem(Size cbNeeded)
  347.  ONEWORDINLINE(0xA04C);
  348.  
  349. #if !GENERATINGCFM
  350. #pragma parameter __D0 CompactMemSys(__D0)
  351. #endif
  352. extern pascal Size CompactMemSys(Size cbNeeded)
  353.  ONEWORDINLINE(0xA44C);
  354.  
  355. #if !GENERATINGCFM
  356. #pragma parameter PurgeMem(__D0)
  357. #endif
  358. extern pascal void PurgeMem(Size cbNeeded)
  359.  ONEWORDINLINE(0xA04D);
  360.  
  361. #if !GENERATINGCFM
  362. #pragma parameter PurgeMemSys(__D0)
  363. #endif
  364. extern pascal void PurgeMemSys(Size cbNeeded)
  365.  ONEWORDINLINE(0xA44D);
  366.  
  367. #if !GENERATINGCFM
  368. #pragma parameter __D0 FreeMem
  369. #endif
  370. extern pascal long FreeMem(void)
  371.  ONEWORDINLINE(0xA01C);
  372.  
  373. #if !GENERATINGCFM
  374. #pragma parameter __D0 FreeMemSys
  375. #endif
  376. extern pascal long FreeMemSys(void)
  377.  ONEWORDINLINE(0xA41C);
  378.  
  379. #if !GENERATINGCFM
  380. #pragma parameter ReserveMem(__D0)
  381. #endif
  382. extern pascal void ReserveMem(Size cbNeeded)
  383.  ONEWORDINLINE(0xA040);
  384.  
  385. #if !GENERATINGCFM
  386. #pragma parameter ReserveMemSys(__D0)
  387. #endif
  388. extern pascal void ReserveMemSys(Size cbNeeded)
  389.  ONEWORDINLINE(0xA440);
  390.  
  391. #if !GENERATINGCFM
  392. #pragma parameter __D0 MaxMem(__A1)
  393. #endif
  394. extern pascal Size MaxMem(Size *grow)
  395.  TWOWORDINLINE(0xA11D, 0x2288);
  396.  
  397. #if !GENERATINGCFM
  398. #pragma parameter __D0 MaxMemSys(__A1)
  399. #endif
  400. extern pascal Size MaxMemSys(Size *grow)
  401.  TWOWORDINLINE(0xA51D, 0x2288);
  402.  
  403. #if !GENERATINGCFM
  404. #pragma parameter SetGrowZone(__A0)
  405. #endif
  406. extern pascal void SetGrowZone(GrowZoneUPP growZone)
  407.  ONEWORDINLINE(0xA04B);
  408.  
  409. #if !GENERATINGCFM
  410. #pragma parameter SetApplLimit(__A0)
  411. #endif
  412. extern pascal void SetApplLimit(void *zoneLimit)
  413.  ONEWORDINLINE(0xA02D);
  414.  
  415. #if !GENERATINGCFM
  416. #pragma parameter MoveHHi(__A0)
  417. #endif
  418. extern pascal void MoveHHi(Handle h)
  419.  ONEWORDINLINE(0xA064);
  420.  
  421. #if !GENERATINGCFM
  422. #pragma parameter DisposePtr(__A0)
  423. #endif
  424. extern pascal void DisposePtr(Ptr p)
  425.  ONEWORDINLINE(0xA01F);
  426. extern pascal Size GetPtrSize(Ptr p);
  427.  
  428. #if !GENERATINGCFM
  429. #pragma parameter SetPtrSize(__A0, __D0)
  430. #endif
  431. extern pascal void SetPtrSize(Ptr p, Size newSize)
  432.  ONEWORDINLINE(0xA020);
  433.  
  434. #if !GENERATINGCFM
  435. #pragma parameter DisposeHandle(__A0)
  436. #endif
  437. extern pascal void DisposeHandle(Handle h)
  438.  ONEWORDINLINE(0xA023);
  439.  
  440. #if !GENERATINGCFM
  441. #pragma parameter SetHandleSize(__A0, __D0)
  442. #endif
  443. extern pascal void SetHandleSize(Handle h, Size newSize)
  444.  ONEWORDINLINE(0xA024);
  445. extern pascal Size GetHandleSize(Handle h);
  446.  
  447. #if !GENERATINGCFM
  448. #pragma parameter __D0 InlineGetHandleSize(__A0)
  449. #endif
  450. extern pascal Size InlineGetHandleSize(Handle h)
  451.  ONEWORDINLINE(0xA025);
  452.  
  453. #if !GENERATINGCFM
  454. #pragma parameter ReallocateHandle(__A0, __D0)
  455. #endif
  456. extern pascal void ReallocateHandle(Handle h, Size byteCount)
  457.  ONEWORDINLINE(0xA027);
  458.  
  459. #if !GENERATINGCFM
  460. #pragma parameter EmptyHandle(__A0)
  461. #endif
  462. extern pascal void EmptyHandle(Handle h)
  463.  ONEWORDINLINE(0xA02B);
  464.  
  465. #if !GENERATINGCFM
  466. #pragma parameter HSetRBit(__A0)
  467. #endif
  468. extern pascal void HSetRBit(Handle h)
  469.  ONEWORDINLINE(0xA067);
  470.  
  471. #if !GENERATINGCFM
  472. #pragma parameter HClrRBit(__A0)
  473. #endif
  474. extern pascal void HClrRBit(Handle h)
  475.  ONEWORDINLINE(0xA068);
  476. extern pascal void MoreMasters(void)
  477.  ONEWORDINLINE(0xA036);
  478.  
  479.  
  480. /*****************************************************************************
  481.  
  482.     The following six routines are System7 only. The latter four of them are
  483.     intended to be used by developers writing drivers:
  484.     
  485.         BlockMove
  486.         BlockMoveData
  487.         
  488.         BlockMoveUncached
  489.         BlockMoveDataUncached
  490.         BlockZero
  491.         BlockZeroUncached
  492.     
  493.     The first two functions (BlockMove and BlockMoveData) exist in both
  494.     “InterfaceLib” and “DriverServicesLib.” You cannot link with both libraries.
  495.     
  496.     The latter four (BlockMoveUncached, BlockMoveDataUncached, BlockZero and
  497.     BlockZeroUncached) do not exist in “InterfaceLib.” You must link with
  498.     “DriverServicesLib” to access them.
  499.  
  500. *****************************************************************************/
  501.  
  502. #if !GENERATINGCFM
  503. #pragma parameter BlockMove(__A0, __A1, __D0)
  504. #endif
  505. extern pascal void BlockMove(const void *srcPtr, void *destPtr, Size byteCount)
  506.  ONEWORDINLINE(0xA02E);
  507.  
  508. #if !GENERATINGCFM
  509. #pragma parameter BlockMoveData(__A0, __A1, __D0)
  510. #endif
  511. extern pascal void BlockMoveData(const void *srcPtr, void *destPtr, Size byteCount)
  512.  ONEWORDINLINE(0xA22E);
  513.  
  514. extern void BlockMoveUncached(const void *srcPtr,void *destPtr,Size byteCount);
  515. extern void BlockMoveDataUncached(const void *srcPtr,void *destPtr,Size byteCount);
  516. extern void BlockZero(void *destPtr,Size byteCount);
  517. extern void BlockZeroUncached(void *destPtr,Size byteCount);
  518.  
  519. extern pascal void PurgeSpace(long *total, long *contig);
  520.  
  521. #if !GENERATINGCFM
  522. #pragma parameter __D0 HGetState(__A0)
  523. #endif
  524. extern pascal SInt8 HGetState(Handle h)
  525.  ONEWORDINLINE(0xA069);
  526.  
  527. #if !GENERATINGCFM
  528. #pragma parameter HSetState(__A0, __D0)
  529. #endif
  530. extern pascal void HSetState(Handle h, SInt8 flags)
  531.  ONEWORDINLINE(0xA06A);
  532.  
  533. #if !GENERATINGCFM
  534. #pragma parameter SetApplBase(__A0)
  535. #endif
  536. extern pascal void SetApplBase(void *startPtr)
  537.  ONEWORDINLINE(0xA057);
  538. extern pascal void MaxApplZone(void)
  539.  ONEWORDINLINE(0xA063);
  540.  
  541. #if !GENERATINGCFM
  542. #pragma parameter __D0 HoldMemory(__A0, __A1)
  543. #endif
  544. extern pascal OSErr HoldMemory(void *address, unsigned long count)
  545.  TWOWORDINLINE(0x7000, 0xA05C);
  546.  
  547. #if !GENERATINGCFM
  548. #pragma parameter __D0 UnholdMemory(__A0, __A1)
  549. #endif
  550. extern pascal OSErr UnholdMemory(void *address, unsigned long count)
  551.  TWOWORDINLINE(0x7001, 0xA05C);
  552.  
  553. #if !GENERATINGCFM
  554. #pragma parameter __D0 LockMemory(__A0, __A1)
  555. #endif
  556. extern pascal OSErr LockMemory(void *address, unsigned long count)
  557.  TWOWORDINLINE(0x7002, 0xA05C);
  558.  
  559. #if !GENERATINGCFM
  560. #pragma parameter __D0 LockMemoryContiguous(__A0, __A1)
  561. #endif
  562. extern pascal OSErr LockMemoryContiguous(void *address, unsigned long count)
  563.  TWOWORDINLINE(0x7004, 0xA05C);
  564.  
  565. #if !GENERATINGCFM
  566. #pragma parameter __D0 UnlockMemory(__A0, __A1)
  567. #endif
  568. extern pascal OSErr UnlockMemory(void *address, unsigned long count)
  569.  TWOWORDINLINE(0x7003, 0xA05C);
  570. extern pascal OSErr GetPhysical(LogicalToPhysicalTable *addresses, unsigned long *physicalEntryCount);
  571.  
  572. #if !GENERATINGCFM
  573. #pragma parameter __D0 DeferUserFn(__A0, __D0)
  574. #endif
  575. extern pascal OSErr DeferUserFn(UserFnUPP userFunction, void *argument)
  576.  ONEWORDINLINE(0xA08F);
  577.  
  578. #if !GENERATINGCFM
  579. #pragma parameter __D0 DebuggerGetMax
  580. #endif
  581. extern pascal long DebuggerGetMax(void)
  582.  TWOWORDINLINE(0x7000, 0xA08D);
  583. extern pascal void DebuggerEnter(void)
  584.  TWOWORDINLINE(0x7001, 0xA08D);
  585. extern pascal void DebuggerExit(void)
  586.  TWOWORDINLINE(0x7002, 0xA08D);
  587. extern pascal void DebuggerPoll(void)
  588.  TWOWORDINLINE(0x7003, 0xA08D);
  589.  
  590. #if !GENERATINGCFM
  591. #pragma parameter __D0 GetPageState(__A0)
  592. #endif
  593. extern pascal PageState GetPageState(const void *address)
  594.  TWOWORDINLINE(0x7004, 0xA08D);
  595.  
  596. #if !GENERATINGCFM
  597. #pragma parameter __D0 PageFaultFatal
  598. #endif
  599. extern pascal Boolean PageFaultFatal(void)
  600.  TWOWORDINLINE(0x7005, 0xA08D);
  601.  
  602. #if !GENERATINGCFM
  603. #pragma parameter __D0 DebuggerLockMemory(__A0, __A1)
  604. #endif
  605. extern pascal OSErr DebuggerLockMemory(void *address, unsigned long count)
  606.  TWOWORDINLINE(0x7006, 0xA08D);
  607.  
  608. #if !GENERATINGCFM
  609. #pragma parameter __D0 DebuggerUnlockMemory(__A0, __A1)
  610. #endif
  611. extern pascal OSErr DebuggerUnlockMemory(void *address, unsigned long count)
  612.  TWOWORDINLINE(0x7007, 0xA08D);
  613.  
  614. #if !GENERATINGCFM
  615. #pragma parameter __D0 EnterSupervisorMode
  616. #endif
  617. extern pascal StatusRegisterContents EnterSupervisorMode(void)
  618.  TWOWORDINLINE(0x7008, 0xA08D);
  619. /* StripAddress and Translate24To32 macro to nothing on PowerPC
  620.    StripAddress is implemented as a trap in System 6 or later */
  621. #if !GENERATINGPOWERPC
  622. #if SystemSixOrLater
  623.  
  624. #if !GENERATINGCFM
  625. #pragma parameter __D0 StripAddress(__D0)
  626. #endif
  627. extern pascal Ptr StripAddress(void *theAddress)
  628.  ONEWORDINLINE(0xA055);
  629. #else
  630. extern pascal Ptr StripAddress(void *theAddress);
  631. #endif
  632. #else
  633. #define StripAddress(x) ((Ptr)(x))
  634. #endif
  635. #if !GENERATINGPOWERPC
  636.  
  637. #if !GENERATINGCFM
  638. #pragma parameter __D0 Translate24To32(__D0)
  639. #endif
  640. extern pascal Ptr Translate24To32(void *addr24)
  641.  ONEWORDINLINE(0xA091);
  642. #else
  643. #define Translate24To32(x) ((Ptr)(x))
  644. #endif
  645. extern pascal OSErr HandToHand(Handle *theHndl);
  646.  
  647. #if !GENERATINGCFM
  648. #pragma parameter __D0 PtrToXHand(__A0, __A1, __D0)
  649. #endif
  650. extern pascal OSErr PtrToXHand(const void *srcPtr, Handle dstHndl, long size)
  651.  ONEWORDINLINE(0xA9E2);
  652. extern pascal OSErr PtrToHand(const void *srcPtr, Handle *dstHndl, long size);
  653.  
  654. #if !GENERATINGCFM
  655. #pragma parameter __D0 HandAndHand(__A0, __A1)
  656. #endif
  657. extern pascal OSErr HandAndHand(Handle hand1, Handle hand2)
  658.  ONEWORDINLINE(0xA9E4);
  659.  
  660. #if !GENERATINGCFM
  661. #pragma parameter __D0 PtrAndHand(__A0, __A1, __D0)
  662. #endif
  663. extern pascal OSErr PtrAndHand(const void *ptr1, Handle hand2, long size)
  664.  ONEWORDINLINE(0xA9EF);
  665. #if OLDROUTINENAMES
  666. #define ApplicZone() ApplicationZone()
  667. #define MFTempNewHandle(logicalSize, resultCode) TempNewHandle(logicalSize, resultCode)
  668. #define MFMaxMem(grow) TempMaxMem(grow)
  669. #define MFFreeMem() TempFreeMem()
  670. #define MFTempHLock(h, resultCode) TempHLock(h, resultCode)
  671. #define MFTempHUnlock(h, resultCode) TempHUnlock(h, resultCode)
  672. #define MFTempDisposHandle(h, resultCode) TempDisposeHandle(h, resultCode)
  673. #define MFTopMem() TempTopMem()
  674. #define ResrvMem(cbNeeded) ReserveMem(cbNeeded)
  675. #define DisposPtr(p) DisposePtr(p)
  676. #define DisposHandle(h) DisposeHandle(h)
  677. #define ReallocHandle(h, byteCount) ReallocateHandle(h, byteCount)
  678. #endif
  679.  
  680. #if PRAGMA_IMPORT_SUPPORTED
  681. #pragma import off
  682. #endif
  683.  
  684. #if PRAGMA_ALIGN_SUPPORTED
  685. #pragma options align=reset
  686. #endif
  687.  
  688. #ifdef __cplusplus
  689. }
  690. #endif
  691.  
  692. #endif /* __MEMORY__ */
  693.